<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue使用之条件渲染</title>
    <script src="../vue.min.js" type="text/javascript"></script>
</head>
<body>
<div id="app">
    <div v-if="flag" key="name">
        <p>Ifname:</p>
        <input type="text" />
    </div>
    <div v-show="flag" key="name">
        <p>Showname:</p>
        <input type="text" />
    </div>
    <div v-else>
        <p>email:</p>
        <input type="text" />
    </div>
    <button @click="change">切换</button>
</div>

<script type="text/javascript">
    var app=new Vue({
        el: '#app',
        data:{
            flag: true
        },
        methods:{
            change:function () {
                this.flag= !this.flag
            }
        }
    })
</script>
</body>
</html>